<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/inc/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>添加商品</title>
		<link type="text/css" rel="stylesheet" href="${path }/js/easyui/themes/default/easyui.css">
		<link type="text/css" rel="stylesheet" href="${path }/js/easyui/themes/icon.css">
		<script type="text/javascript" src="${path }/js/jquery-1.4.2.min.js"></script>
		<script type="text/javascript" src="${path }/js/easyui/jquery.easyui.min.js"></script>
		
		<script type="text/javascript">
			var path="${path}";
		</script>
		<script type="text/javascript" src="${path }/js/form/jquery.form.js"></script>
		<script type="text/javascript" charset="utf-8" src="${path }/js/editor/kindeditor.js"></script>
		<script type="text/javascript" src="${path}/js/date/My97DatePicker/WdatePicker.js"></script>
		<script type="text/javascript">
		
			$(document).ready(function() { 
					var options = {
						beforeSubmit: checkForm,
						dataType : 'json',
						success:addBack
					};
					
				 	$('#addForm').ajaxForm(options); 
					
					KE.show({
				        id : 'content1',
				        items : [
		        			'fullscreen', 'undo', 'redo', 'print', 'cut', 'copy', 'paste',
							'plainpaste', 'wordpaste', 'justifyleft', 'justifycenter', 'justifyright',
							'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
							'superscript', 'selectall', '-',
							'title', 'fontname', 'fontsize', 'textcolor', 'bgcolor', 'bold',
							'italic', 'underline', 'strikethrough', 'removeformat', 'image',
							'flash', 'media', 'table', 'hr', 'emoticons', 'link', 'unlink']
				    });
			}); 
			
			
			
			function checkForm(){
				//return false;
			}
			function addBack(json){
				//var obj = eval('(' + json + ')');
				
				if(json.result=="Success"){
					alert("添加成功!");
					refleshOpener();	
				}
			}
		
			function refleshOpener(){
				ownerDialog.opener.refresh();
				ownerDialog.close();
			}
			
			
			
			function radioChange(state){
				document.forms['addForm'].elements["promotePrice"].disabled = state > 0 ? false : true;
				document.forms['addForm'].elements["promoteStartDate"].disabled = state > 0 ? false : true;
				document.forms['addForm'].elements["promoteEndDate"].disabled = state > 0 ? false : true;
			}
			
			
		</script>
	</head>
	<body>
		<!--  <a href="javascript:void(0)" class="easyui-linkedbutton" onclick="refleshOpener()">刷新</a>-->
		<form action="${path}/manager/goods/save" method="post" id="addForm" name="addForm" ENCTYPE="multipart/form-data">
			<div title="商品基本信息" class="easyui-panel" style="width:750px;height:800px;padding:10px;background:#fafafa;">
				<table >
					<tr>
						<td>
							商品名称:
						</td>
						<td>
							<input type="text" name="goodsName" size="40"><font color="red">*</font>
						</td>
					</tr>
					
					<tr>
						<td>
							商品库存:
						</td>
						<td>
							<input type="text" name="goodsStock" size="20"/>
						</td>
					</tr>
				
					<tr>
						<td>
							市场售价:
						</td>
						<td>
							<input type="text" name="marketPrice" size="20"/>
						</td>
					</tr>
					
					<tr>
						<td>
							本店售价:
						</td>
						<td>
							<input type="text" name="shopPrice" size="20"/>
						</td>
					</tr>
					
					<tr>
						<td>
							商品关键字:
						</td>
						<td>
							<input type="text" name="keyWords" size="20"/>
						</td>
					</tr>
					
					<tr>
						<td>
							是否新款:
						</td>
						<td>
							<input type="radio" name="isBest" value="1" checked/>是
							<input type="radio" name="isBest" value="0"/>否
						</td>
					</tr>
					<tr>
						<td>
							是否精品:
						</td>
						<td>
							<input type="radio" name="isNew" value="1" checked/>是
							<input type="radio" name="isNew" value="0"/>否
						</td>
					</tr>
					<tr>
						<td>
							是否热销:
						</td>
						<td>
							<input type="radio" name="isHot" value="1" checked/>是
							<input type="radio" name="isHot" value="0"/>否
						</td>
					</tr>
					<tr>
						<td>
							是否推荐:
						</td>
						<td>
							<input type="radio" name="isRecom" value="1" checked/>是
							<input type="radio" name="isRecom" value="0"/>否
						</td>
					</tr>
					<tr>
						<td>
							促销相关:
						</td>
						<td>
							<div class="easyui-panel" style="width:300px;height:150px;padding:10px;background:#fafafa;">
								<table>
									<tr>
										<td>
											是否促销:
										</td>
										<td>
											<input type="radio" name="isPromote" value="1" checked onclick="radioChange(1)"/>是
											<input type="radio" name="isPromote" value="0" onclick="radioChange(0)"/>否
										</td>
									</tr>
									<tr>
										<td>
											促销价格:
										</td>
										<td>
											<input type="text" name="promotePrice" size="15">
										</td>
									</tr>
									<tr>
										<td>
											开始时间:
										</td>
										<td>
											<input type="text" name="promoteStart" size="15" onClick="WdatePicker()"/>
										</td>
									</tr>
									<tr>
										<td>
											结束时间:
										</td>
										<td>
											<input type="text" name="promoteEnd" size="15" onClick="WdatePicker()"/>
										</td>
									</tr>
								</table>
							</div>
						</td>
						
					</tr>
					<tr>
						<td>
							拍卖相关:
						</td>
						<td>
							<div class="easyui-panel" style="width:300px;height:230px;padding:10px;background:#fafafa;">
								<table>
									<tr>
										<td>
											是否拍卖:
										</td>
										<td>
											<input type="radio" name="isAuction" value="1" checked />是
											<input type="radio" name="isAuction" value="0" />否
										</td>
									</tr>
									<tr>
										<td>
											拍卖日期:
										</td>
										<td>
											<input type="text" name="auctionDateStart" size="15" onClick="WdatePicker()">
										</td>
									</tr>
									<tr>
										<td>
											拍卖开始时间:
										</td>
										<td>
											<select name="auctionStartHour">
												<c:forEach begin="0" end="23" var="hour">
													<option value="${hour }">${hour }</option>
												</c:forEach>
											</select>
											:
											<select name="auctionStartMin">
												<c:forEach begin="0" end="59" var="min">
													<option value="${min }">${min }</option>
												</c:forEach>
											</select>
										</td>
									</tr>
									<tr>
										<td>
											拍卖结束时间:
										</td>
										<td>
											<select name="auctionEndHour">
												<c:forEach begin="0" end="23" var="hour">
													<option value="${hour }">${hour }</option>
												</c:forEach>
											</select>
											:
											<select name="auctionEndMin">
												<c:forEach begin="0" end="59" var="min">
													<option value="${min }">${min }</option>
												</c:forEach>
											</select>
										</td>
									</tr>
									<tr>
										<td>
											拍卖开拍价:
										</td>
										<td>
											<input type="text" name="auctionStartPrice" size="15">
										</td>
									</tr>
									<tr>
										<td>
											拍卖最低加价:
										</td>
										<td>
											<input type="text" name="minAdd" size="15">
										</td>
									</tr>
									<tr>
										<td>
											拍卖最高加价:
										</td>
										<td>
											<input type="text" name="maxAdd" size="15">
										</td>
									</tr>
								</table>
							</div>
						</td>
						
					</tr>
					<tr>
						<td>
							商品概述:
						</td>
						<td>
							<textarea name="goodsBrief" rows="4" cols="30"></textarea>
						</td>
					</tr>
					
				</table>
			</div>
			<!--  
			<br/>
			<div id="attrDiv" title="商品属性" class="easyui-panel" style="width:350px;height:150px;padding:10px;background:#fafafa;">
				请选择商品分类
			</div>
			
			<br/>
			-->
			<div title="商品缩略图" class="easyui-panel" style="width:750px;height:100px;padding:10px;background:#fafafa;">
				<div style="width:400;float:left">
					<table>
						<!--  
						<tr>
							<td>
								<a href="javascript:void(0)" onclick="addImgFile()">添加</a>
							</td>
						</tr>
						-->
						<tr>
							<td>
								商品缩略图:
							</td>
							<td>
								<input type="file" id="goodsThumbFile" name="goodsThumbFile" size="20" />
								<div id="fileDiv" style="width:300px;">
									
								</div>
								
							</td>
						</tr>
					</table>
				</div>
				<div id="imgDiv" style="width:300;float:left">
					
				</div>
			</div>
			
			<div title="商品详细描述" class="easyui-panel" style="width:750px;height:260px;padding:10px;background:#fafafa;">
				<table>
					<tr>
						<td>
							<textarea id="content1" name="goodsDesc" style="width: 700px; height: 200px; visibility: hidden;"></textarea>
						</td>
					</tr>
				</table>
			</div>
			<div>
				<table>
					<tr>
						<td>
							<input type="submit" value="保存">
						</td>
					</tr>
				</table>
			</div>
			
		</form>
	</body>
</html>